package cn.yj.syslog.mapper;


import cn.yj.common.NameValue;
import cn.yj.syslog.entity.PageView;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

/**
 * <br>
 *
 * @author 永健
 * @since 2020-12-17 18:30
 */
public interface PageViewMapper extends BaseMapper<PageView> {

    long countVisitByDate(Date date);

    @Select("SELECT COUNT(school_name) as value ,school_name as `name` from tb_page_view  GROUP BY school_name")
    List<NameValue> pieChart();

    long countVisitByDateRange(@Param("startTime") Date startDate, @Param("endTime") Date endDate);

    @Select("SELECT COUNT(DISTINCT ip)   from tb_page_view ")
    long allCount();
}
